<%@page import="com.sinba.common.dto.PageDTO"%>
<%@page import="com.sinba.common.system.dto.TransactionRecordDTO"%>
<%@page import="com.sinba.common.system.service.ITransactionRecordService"%>
<%@page import="com.sinba.common.user.dto.AccountDTO"%>
<%@page import="com.sinba.common.user.service.IAccountService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
if(session.getAttribute("password2")==null){
	response.sendRedirect( "login2.jsp?pageUrl=user/bonus.jsp");
	return;
}

ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
ITransactionRecordService transactionRecordService = (ITransactionRecordService)ac.getBean("transactionRecordService");
TransactionRecordDTO trDTO = new TransactionRecordDTO();
trDTO.setLoginName((String)session.getAttribute("loginName"));
int pages = 1;
String sidx = "optDate";
String sord="desc";
if(request.getParameter("pages")!=null && request.getParameter("_pages")!=""){
	pages = Integer.parseInt(request.getParameter("pages"));
}
int rows = 10;
int start = ( pages - 1 ) * rows;
trDTO.setStart( start );
trDTO.setLimit( rows );
trDTO.setSearchType("bonus");
if(request.getParameter("trDTO.transactionType")!=null && request.getParameter("trDTO.transactionType")!=""){
	trDTO.setTransactionType(request.getParameter("trDTO.transactionType"));
	pages=1;
}
trDTO.setSearchType("bonus");
PageDTO pageDTO = transactionRecordService.findTransactionRecordPager(trDTO, sord, sidx);
if(pageDTO!=null){
	pageDTO.setPage( pages );
	pageDTO.setRows( rows );
}
request.setAttribute("pageDTO",pageDTO);

%>
<fmt:setLocale value="${empty cookie['language'].value?'zh_CN':cookie['language'].value}"/>
	<fmt:setBundle basename="i18n.itilbase"/>
	<c:set var="lang" value="${empty cookie['language'].value?'zh_CN':cookie['language'].value}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta charset="UTF-8">
<title>奖金明细- </title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="scripts/jquery/easyui/themes/default/validatebox.css">
<link rel="stylesheet" href="scripts/jquery/easyui/themes/default/window.css">
<link rel="stylesheet" href="scripts/jquery/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="styles/index.css" />
<script type="text/javascript" src="scripts/jquery/jquery-1.4.2.min.js"></script>
<script src="scripts/jquery/easyui/jquery.easyui.min.js"></script>
<script src="web/js/easyui_validator_comm.js"></script>
<script src="scripts/jquery/easyui/locale/easyui-lang-zh_CN.js"></script>
<script src="web/js/common.js"></script>
<script type="text/javascript" src="web/js/hall.js"></script>

<script>

$(function(){
	//showTransRecord('tr_recommend_table','tr_recommend_pager','recommend',1,10,'optDate','desc');
	//showDirectPushUser('tr_recommendGrid_table','tr_recommendGrid_pager','${user.loginName}',1,10,'registerTime','desc');
    $("#doSeach").click(function(){
    	$("#bonusSeachForm").submit();
    });
    $("#bonusTable").find("tr").addClass("color1");
	$("#bonusTable").find("tr:odd").addClass("color2");
})

</script>
</head>
<body style="height:800px">
<jsp:include page="top.jsp"></jsp:include>

<!-- 主体内容 -->
<div class="wrapper">
	<div class="site">您当前的位置：财务管理   &gt;   收益明细</div>
	<div class="content">

<form id="bonusSeachForm" action="bonus.jsp" method="post">
<input name="sidx" value="optDate" type="hidden" >
<input name="sord" value="desc" type="hidden" >
<input name="trDTO.searchType" value="bonus" type="hidden" >
<input name="trDTO.loginName" value="${session.loginName }" type="hidden" >
<table width="100%">
			<tr>
			 	<td>
			 	   类型 <select name="trDTO.transactionType">
			 	   	<option value="">--请选择--</option>
			 	   	<option value="销售佣金">销售佣金</option>
			 	   	 <option value="销售管理佣金">销售管理佣金</option>
			 	   	 <option value="财富见点佣金">财富见点佣金</option>
			 	   	 <option value="财富见点管理佣金">财富见点管理佣金</option>
			 	   	 <option value="成员倒钩佣金">成员倒钩佣金</option>
			 	   	  <option value="运营中心">运营中心</option>
			 	   </select>
			 	</td>
			 	<td>
			 		结算日期 <input name="trDTO.startTime" class="easyui-datebox"></input> 至  <input name="trDTO.endTime" class="easyui-datebox"/> 
			 		<a style="cursor: pointer;" id="doSeach"><input type="button" value="搜索" /></a>
			 	</td>
			</tr>
</table>
</form>

<table class="mytable" id="bonusTable">
		        		<thead>
		        			
		        			<tr class="color1">
		        				<th>类型</th>
		        				<th>交易金额</th>
		        				<th>操作时间</th>
		        				<th>详细</th>
		        			</tr>
		        			
		        		</thead>
		        		<tbody>
		        			<c:forEach items="${pageDTO.data}" var="data">
		        				<tr>
		        					<td>${data.transactionType}</td>
		        					<td>${data.sumOfMoney}</td>
		        					<td><fmt:formatDate value="${data.optDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		        					<td>${data.remark}</td>
		        				</tr>
		        			</c:forEach>
		        			<c:if test="${empty pageDTO.data}">
		        				<tr>
		        					<td colspan="5" align="center">暂无数据!</td>
		        				</tr>
		        			</c:if>
		        		</tbody>		        		
		        	</table>
		        	<div class="pageNav">
		        		<%
		        		
		        		%>
		        		<a href="bonus.jsp?pages=1">首页</a>
		        		<c:if test="${pageDTO.page!=1}">
		        			<a href="bonus.jsp?pages=${pageDTO.page-1}">上一页-</a>
		        		</c:if>
		        		当前页:${pageDTO.page}/${pageDTO.total}
		        		<c:if test="${pageDTO.page+1<=pageDTO.total}">
		        			<a href="bonus.jsp?pages=${pageDTO.page+1}">-下一页</a>
		        		</c:if>
		        		<a href="bonus.jsp?pages=${pageDTO.total}">尾页</a>
		        		-共${pageDTO.totalSize}条
		        	</div>
		        	
		        	</div></div>
		        <jsp:include page="bottom.jsp"></jsp:include>
</body>
</html>